package com.fish.anne.model;

import com.fish.anne.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="system_admin_log" )
public class SystemAdminLog extends BaseObject implements Serializable {
    private Long logId;
    private String actionCode;
    private Long adminId;
    private String logInfo;
    private String logIp;
    private Long logTime;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getLogId() {
        return this.logId;
    }
    
    public void setLogId(Long logId) {
        this.logId = logId;
    }
    
    @Column(name="action_code", nullable=false, length=30)
    public String getActionCode() {
        return this.actionCode;
    }
    
    public void setActionCode(String actionCode) {
        this.actionCode = actionCode;
    }
    
    @Column(name="admin_id", nullable=false)
    public Long getAdminId() {
        return this.adminId;
    }
    
    public void setAdminId(Long adminId) {
        this.adminId = adminId;
    }
    
    @Column(name="log_info", nullable=false)
    public String getLogInfo() {
        return this.logInfo;
    }
    
    public void setLogInfo(String logInfo) {
        this.logInfo = logInfo;
    }
    
    @Column(name="log_ip", nullable=false, length=15)
    public String getLogIp() {
        return this.logIp;
    }
    
    public void setLogIp(String logIp) {
        this.logIp = logIp;
    }
    
    @Column(name="log_time", nullable=false)
    public Long getLogTime() {
        return this.logTime;
    }
    
    public void setLogTime(Long logTime) {
        this.logTime = logTime;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SystemAdminLog pojo = (SystemAdminLog) o;

        if (actionCode != null ? !actionCode.equals(pojo.actionCode) : pojo.actionCode != null) return false;
        if (adminId != null ? !adminId.equals(pojo.adminId) : pojo.adminId != null) return false;
        if (logInfo != null ? !logInfo.equals(pojo.logInfo) : pojo.logInfo != null) return false;
        if (logIp != null ? !logIp.equals(pojo.logIp) : pojo.logIp != null) return false;
        if (logTime != null ? !logTime.equals(pojo.logTime) : pojo.logTime != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (actionCode != null ? actionCode.hashCode() : 0);
        result = 31 * result + (adminId != null ? adminId.hashCode() : 0);
        result = 31 * result + (logInfo != null ? logInfo.hashCode() : 0);
        result = 31 * result + (logIp != null ? logIp.hashCode() : 0);
        result = 31 * result + (logTime != null ? logTime.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("logId").append("='").append(getLogId()).append("', ");
        sb.append("actionCode").append("='").append(getActionCode()).append("', ");
        sb.append("adminId").append("='").append(getAdminId()).append("', ");
        sb.append("logInfo").append("='").append(getLogInfo()).append("', ");
        sb.append("logIp").append("='").append(getLogIp()).append("', ");
        sb.append("logTime").append("='").append(getLogTime()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
